<template>
  <div class="bidding-show-box basic-from">
    <v-dialog title="查看" class="small-padding-dialog" :show.sync="dialogVisible" width="1200px" :close-on-click-modal="false">
      <div class="card-title">工程信息</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="工程名称" prop="projectName">
          <span class="int-text">{{showForm.projectName}}</span>
        </el-form-item>
        <el-form-item label="工程地址" prop="projectAddress">
          <span class="int-text">{{showForm.projectAddress}}</span>
        </el-form-item>
        <el-form-item label="工程类型" prop="projectType">
          <span class="int-text">{{getCardTypeValue(showForm.projectType,projectTypes)}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">设计招标信息</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="中标文号" prop="designDocument">
          <span class="int-text">{{showForm.designDocument}}</span>
        </el-form-item>
        <el-form-item label="中标单位" prop="designUnit">
          <span class="int-text">{{showForm.designUnit}}</span>
        </el-form-item>
        <el-form-item label="金额(元)" prop="designAmount">
          <span class="int-text">{{showForm.designAmount | thousandMoney}}</span>
        </el-form-item>
        <el-form-item label="中标日期" prop="designDate">
          <span class="int-text">{{showForm.designDate}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">监理招标信息</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="中标文号" prop="supervisorDocument">
          <span class="int-text">{{showForm.supervisorDocument}}</span>
        </el-form-item>
        <el-form-item label="中标单位" prop="supervisorUnit">
          <span class="int-text">{{showForm.supervisorUnit}}</span>
        </el-form-item>
        <el-form-item label="金额(元)" prop="supervisorAmount">
          <span class="int-text">{{showForm.supervisorAmount | thousandMoney}}</span>
        </el-form-item>
        <el-form-item label="中标日期" prop="supervisorDate">
          <span class="int-text">{{showForm.supervisorDate}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">造价咨询信息</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="中标文号" prop="costDocument">
          <span class="int-text">{{showForm.costDocument}}</span>
        </el-form-item>
        <el-form-item label="中标单位" prop="costUnit">
          <span class="int-text">{{showForm.costUnit}}</span>
        </el-form-item>
        <el-form-item label="金额(元)" prop="costAmount">
          <span class="int-text">{{showForm.costAmount | thousandMoney}}</span>
        </el-form-item>
        <el-form-item label="中标日期" prop="costDate">
          <span class="int-text">{{showForm.costDate}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">招标代理信息</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="中标文号" prop="agentDocument">
          <span class="int-text">{{showForm.agentDocument}}</span>
        </el-form-item>
        <el-form-item label="中标单位" prop="agentUnit">
          <span class="int-text">{{showForm.agentUnit}}</span>
        </el-form-item>
        <el-form-item label="金额(元)" prop="agentAmount">
          <span class="int-text">{{showForm.agentAmount | thousandMoney}}</span>
        </el-form-item>
        <el-form-item label="中标日期" prop="agentDate">
          <span class="int-text">{{showForm.agentDate}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">施工招标信息</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="中标文号" prop="constructionDocument">
          <span class="int-text">{{showForm.constructionDocument}}</span>
        </el-form-item>
        <el-form-item label="中标单位" prop="constructionUnit">
          <span class="int-text">{{showForm.constructionUnit}}</span>
        </el-form-item>
        <el-form-item label="金额(元)" prop="constructionAmount">
          <span class="int-text">{{showForm.constructionAmount | thousandMoney}}</span>
        </el-form-item>
        <el-form-item label="中标日期" prop="constructionDate">
          <span class="int-text">{{showForm.constructionDate}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">附件</div>
      <div class="handling-opinions">
        <v-upload
          ref="tenderInfoUpload"
          :busId="showForm.projectTenderId"
          modelType="tenderInfo"
          isShowFileList
          :isView="true"
          multiple
          v-model="fileList"
        />
      </div>
      <span slot="foot">
        <el-button @click="$bus.$emit('operationLog', showForm.projectId)">操作日志</el-button>
        <el-button type="primary" @click="shutDown()">关闭</el-button>
      </span>
    </v-dialog>
  </div>
</template>

<script>
import { get } from '../api/tenderInfo'

export default {
  name: "show-actual",
  mounted () {
    this.projectTypes = this.getDict("epc_project_type")
  },
  data () {
    return {
      dialogVisible: false,
      fileList: [],
      projectTypes: [],
      showForm: {
        projectId: '',
        projectSetupId: '',
        projectTenderId: '',
        projectName: '',
        projectAddress: '',
        projectType: '',
        designDocument: '',
        designUnit: '',
        designAmount: '',
        designDate: '',
        supervisorDocument: '',
        supervisorUnit: '',
        supervisorAmount: '',
        supervisorDate: '',
        costDocument: '',
        costUnit: '',
        costAmount: '',
        costDate: '',
        agentDocument: '',
        agentUnit: '',
        agentAmount: '',
        agentDate: '',
        constructionDocument: '',
        constructionUnit: '',
        constructionAmount: '',
        constructionDate: ''
      }
    }
  },
  methods: {
    //打开弹框
    show (item) {
      this.dialogVisible = true
      if (item) {
        this.showForm.projectTenderId = item
        get(item).then(res => {
          if (res.data.code === 0 && res.data.data.epcProjectTender !== null) {
            this.showForm = res.data.data.epcProjectTender
          } else {
            this.$message.warning('暂未获取到数据！')
          }
        })
      }
    },
    //关闭弹框
    beforeClose (done) {
      this.$emit('beforeClose')
    },
    shutDown () {
      this.$emit('handleClose')
      this.dialogVisible = false
    },
    //对应value取label
    getCardTypeValue (num, sum) {
      let arr = sum.filter(e => e.value === num)
      if (arr.length > 0) {
        return arr[0].label
      } else {
        return num
      }
    }
  }
}
</script>

<style scoped lang="scss">
.card-box {
  min-height: 55px;
  .handling-opinions {
    padding: 20px;
  }
  .int-text {
    color: #999;
  }
}
</style>
